package com.weigee.ktv.p.frag;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.os.Bundle;
import android.support.annotation.NonNull;

import com.l.d.app.library.util.ContextUtil;
import com.weigee.ktv.p.TaskDetailContract;

/**
 * Created by linde on 2017/5/5.
 * <p/>
 */
public class AboutUsPresenterImpl implements TaskDetailContract.AboutUsPresenter
{
    @NonNull
    private final TaskDetailContract.AboutUsView view;

    public AboutUsPresenterImpl(@NonNull TaskDetailContract.AboutUsView view)
    {
        this.view = view;
    }

    @Override
    public void onCreated(Bundle savedInstanceState)
    {

    }

    @Override
    public void onViewCreated(Bundle savedInstanceState)
    {

    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState)
    {
        initPackageInfo();
    }

    private void initPackageInfo()
    {
        final Context context = view.getMyContext();
        final PackageInfo info = ContextUtil.getPackageInfo(context);
        String result;
        if (info != null)
        {
            result = "当前版本 " + info.versionName;
        }
        else
        {
            result = null;
        }
        view.setPackageInfo(result);
    }

    @Override
    public void onStart()
    {

    }

    @Override
    public void onResume()
    {

    }

    @Override
    public void onPause()
    {

    }

    @Override
    public void onStop()
    {

    }

    @Override
    public void onDestroy()
    {

    }

    @Override
    public void onLoadData(Object... objects)
    {
    }

    @Override
    public void onLoadListData(boolean moreData)
    {

    }
}
